﻿using System;


namespace epicenter2010.Aggregates
{
	/// <summary>
	/// bstack @ 05/06/2010
	/// Customer entity
	/// </summary>
	public class Customer : epicenter2010.Common.EntityBase<int>
	{
		/// <summary>
		/// Name
		/// </summary>
		public readonly string Name;

		/// <summary>
		/// Type
		/// </summary>
		public epicenter2010.Aggregates.CustomerType Type;

		/// <summary>
		/// Address
		/// </summary>
		public readonly epicenter2010.Aggregates.Address Address;

		/// <summary>
		/// Contact detail
		/// </summary>
		public readonly epicenter2010.Aggregates.ContactDetail ContactDetail;


		/// <summary>
		/// Ctor
		/// </summary>
		/// <param name="Id">Id</param>
		/// <param name="name">Name</param>
		/// <param name="type">Customer type</param>
		/// <param name="address">Address</param>
		/// <param name="email">Email, this is optional</param>
		/// <param name="phone">Phone</param>
		public Customer(
			int Id,
			string name,
			epicenter2010.Aggregates.CustomerType type,
			epicenter2010.Aggregates.Address address,
			epicenter2010.Aggregates.ContactDetail contactDetail) : base(Id, DateTimeOffset.UtcNow)
		{
			epicenter2010.Common.DBCChecker.RequireArgumentNotEmpty("name", name);
			epicenter2010.Common.DBCChecker.RequireArgumentNotNull("address", address);
			epicenter2010.Common.DBCChecker.RequireArgumentNotNull("contactDetail", contactDetail);

			this.Name = name;
			this.Type = type;
			this.Address = address;
			this.ContactDetail = contactDetail;
		}
	}
}
